package cn.iocoder.yudao.module.handguard.dal.mysql.productaccess;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.handguard.dal.dataobject.productaccess.ProductAccessDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.handguard.controller.admin.productaccess.vo.*;

/**
 * 产品准入 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ProductAccessMapper extends BaseMapperX<ProductAccessDO> {

    default PageResult<ProductAccessDO> selectPage(ProductAccessPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProductAccessDO>()
                .likeIfPresent(ProductAccessDO::getProductName, reqVO.getProductName())
                .eqIfPresent(ProductAccessDO::getPublicityTypeId, reqVO.getPublicityTypeId())
                .betweenIfPresent(ProductAccessDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProductAccessDO::getCreateTime));
    }

    default List<ProductAccessDO> selectList(ProductAccessExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ProductAccessDO>()
                .likeIfPresent(ProductAccessDO::getProductName, reqVO.getProductName())
                .eqIfPresent(ProductAccessDO::getPublicityTypeId, reqVO.getPublicityTypeId())
                .betweenIfPresent(ProductAccessDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProductAccessDO::getId));
    }

}
